home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Art
/
I
/
Imagic.cpt
/
External Functions
/
Grid Source
/
XFunctions.c
< prev
next >
Wrap
Text File
|
1992-04-01
|
7KB
|
298 lines
/**************************************************************************************************
* XFunctions.c
*
* Written By: Brian Powell
* (c) 1991, All Rights Reserved.
*
* This contains all of the code responsible for calling routines within Imagic. Imagic
* sends an array of ProcPtr's to the external function which are then called here when the
* programmer uses one of my library routines. These are the routines.
*
*************************************************************************************************/
#include "XFunctionNumbers.h"
#include "XFunctions.h"
/* External Globals */
extern const ProcPtr (*(**functions)());
/* This is where all of the functions are held */
/**************************************************************************************************
* I M A G E U T I L I T I E S
*************************************************************************************************/
pascal ImageHandle NewBlankImage(name, xsize, ysize, visible, topleft, botright, projection)
StringPtr name;
int xsize, ysize;
Boolean visible;
Point *topleft;
Point *botright;
short projection;
{
return ((ImageHandle)((functions[NEWBLANKIMAGE])(xsize, ysize, visible, name, topleft,
botright, projection)));
}
pascal ImageHandle CopyImage(image)
ImageHandle image;
{
return ((ImageHandle)((functions[COPYIMAGE])(image)));
}
pascal void GetImageSize(image, x, y)
ImageHandle image;
int *x, *y;
{
(functions[GETIMAGESIZE])(image, x, y);
}
pascal Boolean BeginImageWork(image, NeedUndo)
ImageHandle image;
Boolean NeedUndo;
{
if (image == NIL) return FALSE;
return((Boolean)(functions[BEGINIMAGEWORK])(image, NeedUndo));
}
pascal void EndImageWork(image)
ImageHandle image;
{
(functions[ENDIMAGEWORK])(image);
}
pascal int GetPixVal(image, xloc, yloc)
ImageHandle image;
int xloc, yloc;
{
return ((int)((functions[GETPIXVAL])(image, xloc, yloc)));
}
pascal void SetPixVal(image, xloc, yloc, value)
ImageHandle image;
int xloc, yloc;
PixelVal value;
{
(functions[SETPIXVAL])(image, xloc, yloc, value);
}
pascal void GetPixLineVal(image, vals, line, x)
ImageHandle image;
PixelValPtr *vals;
int line, x;
{
(PixelValPtr)(functions[GETPIXLINEVAL])(image, vals, line, x);
}
pascal void SetPixLineVal(image, values, line, x)
ImageHandle image;
PixelValPtr values;
int line, x;
{
(functions[SETPIXLINEVAL])(values, image, line, x);
}
pascal void PixToScaledVal(image, values, newvals)
ImageHandle image;
PixelValPtr values;
ScaledValPtr *newvals;
{
(functions[PIXTOSCALEDVAL])(image, values, newvals);
}
pascal void ScaledValToPix(image, values, newvals)
ImageHandle image;
ScaledValPtr values;
PixelValPtr *newvals;
{
(functions[SCALEDVALTOPIX])(image, values, newvals);
}
pascal ImageHandle GetTopImage()
{
return ((ImageHandle)((functions[GETTOPIMAGE])()));
}
pascal StringPtr GetImageName(image)
ImageHandle image;
{
return ((char *)(functions[GETIMAGENAME])(image));
}
pascal void EraseImage(image)
ImageHandle image;
{
(functions[ERASEIMAGE])(image);
}
pascal void DisposImage(image)
ImageHandle image;
{
(functions[DISPOSIMAGE])(image);
}
pascal void GetImageGeography(image, topleft, botright, projection)
ImageHandle image;
Point *topleft;
Point *botright;
short *projection;
{
(functions[GETIMAGEGEOGRAPHY])(image, topleft, botright, projection);
}
pascal void PixToLatLon(image, x, y, lat, lon)
ImageHandle image;
int x, y;
double *lat, *lon;
{
(functions[PIXTOLATLON])(image, x, y, lat, lon);
}
pascal void LatLonToPix(image, lat, lon, x, y)
ImageHandle image;
double lat, lon;
int *x, *y;
{
(functions[LATLONTOPIX])(image, lat, lon, x, y);
}
pascal void CopyCTable(image, newimage)
ImageHandle image, newimage;
{
(functions[COPYCTABLE])(image, newimage);
}
/**************************************************************************************************
* U S E R I N T E R F A C E U T I L I T I E S
*************************************************************************************************/
pascal Boolean CreateProgressDialog(name, value)
StringPtr name;
int value;
{
return ((Boolean)((functions[CREATEPROGRESSDIALOG])(name, value)));
}
pascal Boolean UpdateProgressDialog(value)
int value;
{
return((Boolean)((functions[UPDATEPROGRESSDIALOG])(value)));
}
pascal void DisposProgressDialog()
{
(functions[DISPOSPROGRESSDIALOG])();
}
pascal int CreateDialog(text, Label1, Label2, Label3, beep)
StringPtr text, Label1, Label2, Label3;
Boolean beep;
{
return ((int)((functions[CREATEDIALOG])(text, Label1, Label2, Label3, beep)));
}
pascal void MessageDialog(title, beep)
StringPtr title;
Boolean beep;
{
(functions[CREATEDIALOG])(title, (StringPtr)"Ok", NULL, NULL, beep);
}
pascal ImageHandle **GetImageList(min, max, message, nFiles)
int min, max;
StringPtr message;
int *nFiles;
{
return ((ImageHandle **)(functions[GETLISTOFIMAGES])(min, max, message, nFiles));
}
pascal int GetVersion()
{
return ((int)(functions[GETVERSION])());
}
pascal Boolean TextFilter(theDialog, event, item)
DialogPtr theDialog;
EventRecord *event;
int *item;
{
return ((Boolean)(functions[TEXTFILTER])(theDialog, event, item));
}
pascal void PlaceWindow(theWindow, x, y)
WindowPtr theWindow;
int x,y;
{
(functions[PLACEWINDOW])(theWindow, x, y);
}
pascal void OutlineButton(theDialog, item)
DialogPtr theDialog;
int item;
{
(functions[OUTLINEBUTTON])(theDialog, item);
}
/**************************************************************************************************
* M E M O R Y M A N A G E R U T I L I T I E S
*************************************************************************************************/
pascal Handle CreateNewHandle(size)
Size size;
{
return ((Handle)((functions[CREATENEWHANDLE])(size)));
}
pascal Ptr CreateNewPtr(size)
Size size;
{
return ((Ptr)((functions[CREATENEWPTR])(size)));
}
pascal void DestroyHandle(theHandle)
Handle theHandle;
{
(functions[DESTROYHANDLE])(theHandle);
}
pascal void DestroyPtr(thePtr)
Ptr thePtr;
{
(functions[DESTROYPTR])(thePtr);
}
/**************************************************************************************************
* NOT IMPLEMENTED...
*************************************************************************************************/
/* This is currently not implemented because the variable argument list uses the
* registers to manipulate the data which is BAD, BAD for the XModules. They rely
* on the registers to stay approximately the same, esp. A0 & A4. This may be
* implemented later.
*
* pascal OSErr dialogprintf(char *fmt, ...)
* {
* char string[400];
* va_list args;
*
* va_start(args, fmt);
* vsprintf(string, fmt, args);
* va_end(args);
* CtoPstr(string);
* return;
* return ((functions[0])(string, "\pOk", NULL, NULL, TRUE));
* }
*
*/